import { Sequelize } from "sequelize";

const { APP_MYSQL_PORT, APP_MYSQL_DATABASE, APP_MYSQL_USERNAME, APP_MYSQL_PASSWORD, APP_MYSQL_HOST } = process.env;

const sequelize = new Sequelize(APP_MYSQL_DATABASE as string, APP_MYSQL_USERNAME as string, APP_MYSQL_PASSWORD as string, {
  dialect: "mysql",
  host: APP_MYSQL_HOST,
  port: Number(APP_MYSQL_PORT as string),
  pool: {
    max: 5,
    min: 0,
    idle: 10000,
  },
});


export default sequelize;
